import React from 'react'
import './Tabs.scss'

export default function Tabs(props) {
  const { current, setCurrent, tabs=[] } = props
  // tabs = [{id: '', name: ''}]   or   tabs = ['','']

  const change= (index) => {
    setCurrent(index)
  }
  return (
    <div className='tabs'>
      {/* <div className='tab-item active'>登录</div> */}
      {
        tabs.map((item, index) => {
          return (
            <div className={current === index ? 'tab-item active' : 'tab-item'} key={item?.id || item} onClick={() => change(index)}>
              <span>{item?.name || item}</span>
            </div>
          )
        })
      }
      
    </div>
)
}
